package cn.iocoder.yudao.module.handguard.dal.mysql.usertablesaudit;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.handguard.dal.dataobject.usertablesaudit.UserTablesAuditDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.handguard.controller.app.usertablesaudit.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 用户-完善资料记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserTablesAuditMapper extends BaseMapperX<UserTablesAuditDO> {

    default PageResult<UserTablesAuditDO> selectPage(UserTablesAuditPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserTablesAuditDO>()
                .eqIfPresent(UserTablesAuditDO::getOrderId, reqVO.getOrderId())
                .likeIfPresent(UserTablesAuditDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(UserTablesAuditDO::getResultValue, reqVO.getResultValue())
                .eqIfPresent(UserTablesAuditDO::getIsPassed, reqVO.getIsPassed())
                .betweenIfPresent(UserTablesAuditDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserTablesAuditDO::getId));
    }

    default List<UserTablesAuditDO> selectList(UserTablesAuditExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<UserTablesAuditDO>()
                .eqIfPresent(UserTablesAuditDO::getOrderId, reqVO.getOrderId())
                .likeIfPresent(UserTablesAuditDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(UserTablesAuditDO::getResultValue, reqVO.getResultValue())
                .eqIfPresent(UserTablesAuditDO::getIsPassed, reqVO.getIsPassed())
                .betweenIfPresent(UserTablesAuditDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserTablesAuditDO::getId));
    }

    int deleteAllByOrderId(@Param("orderId") Long orderId,@Param("typeName") String typeName);

    int updateByOrderId(@Param("orderId") Long orderId,@Param("isPass") String isPass);

    public List<UserTablesAuditDO> getDefaultAudit();
}
